<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>机场维护aircraftMaintaince</title>
	</head>
	<link rel="stylesheet" href="../css/common.css" />
	<link rel="stylesheet" href="../css/less/common_less.css" />
	<link rel="stylesheet" href="../css/airportMaintaince.css" />
	<style>
		.newPlan{
			background:#ff7777;
		}
		.edit{
			cursor:pointer;
			color: #faa000;
		}
		
	</style>
	<body>
		<div class='btnBox'>
			<button class='newSeriesBtn add'><i class="iconfont setIcon">&#xe627;</i>添加</button>
		</div>
		<div class='dataTable'>
			<table id="dataTable">
				<thead>
					<tr class='topTr'>
						<th>机场三字码</th>
						<th style='width:200px;'>机场中文名称</th>
						<th>城市三字码</th>
						<th>城市中文名</th>
						<th>城市英文名</th>
						<th>国家中文名</th>
						<th>国家英文名</th>
						<th>是否为热点机场</th>
						<th style='width:80px;'>操作</th>
					</tr>
				</thead>
				<tbody class="clear">	
				
				</tbody>			
			</table>
		</div>
		
		
		
		<!-- 分页功能 -->
		<div class='Pagination'></div>
	</body>
		<script type="text/javascript" src="../js/jquery-1.12.4.js" ></script>
		<script type="text/javascript" src="../js/jquery.freezeheader.js" ></script>
		<script type="text/javascript" src="../layer-v2.4/layer/layer.js" ></script>
		<!-- 引入my97日期时间控件 -->
		<script type="text/javascript" src="../js/My97DatePicker/WdatePicker.js" charset="utf-8"></script>	
		<script type="text/javascript" src="../js/common.js" ></script>
	<!--	<script type="text/javascript" src="../js/airportMaintaince.js" ></script>   -->
		<script>
			
			var totalAmount
			var totalPage
			var nowPage
			function getAjax(){
				var pageNum = $(".page").val()-0;
				var pageSize = $(".pageSize").val()-0;
				
				$.get("../Airapt?pageNum="+pageNum+"&pageSize="+pageSize+"&temp="+Math.random(),function(data){
					data = JSON.parse(data)
					totalAmount = data.data.total
					totalPage = data.data.pages
					nowPage = data.data.pageNum
					//共多少条
					$(".totalAmount").text(totalAmount)
					//共多少页
					$(".totalPage").text(totalPage)
					//第几页
					$(".nowPage").text(nowPage)
					$(".clear").empty();
					var str = "";
					for(var i=0;i<data.data.list.length;i++){
						if(data.data.list[i].airportHot=="1"){
							data.data.list[i].airportHot="热点"
						}if(data.data.list[i].airportHot=="0"){
							data.data.list[i].airportHot="非热点"
						}
						str+="<tr>"+
								
								"<td class='airportCode'>"+data.data.list[i].airportCode+"</td>"+
								"<td>"+data.data.list[i].airportCnNm+"</td>"+
								"<td>"+data.data.list[i].cityCode+"</td>"+
								"<td>"+data.data.list[i].cityCnNm+"</td>"+
								"<td>"+data.data.list[i].cityEnNm+"</td>"+
								"<td>"+data.data.list[i].countryCnNm+"</td>"+
								"<td>"+data.data.list[i].countryEnNm+"</td>"+
								"<td>"+data.data.list[i].airportHot+"</td>"+
								"<td><span  title='编辑' class='edit iconfont'>&#xe681;</span></td>"+
							 "</tr>"
					}
					$(".clear").append(str)
					$(".clear>tr:even").css("background","#f8f8f8");
				})												
			}
			
			
			
			
//_____________________________________________________________________添加
			$(".add").click(function(){				
					layer.open({
						type: 2,
						title: ['添加机场','background-color:#6d6e72; color:#fff;font-size:14px;'],
						shadeClose: true,
						shade: [0.9,'#cfcfcf'],
						area: ['500px', '380px'],  
						content: ['../ak/addAirportMaintaince.html'],// iframe的url，no代表不显示滚动条
						end:function(){
							getAjax()
						}
							
					});		
			})
//_____________________________________________________________________编辑
			
			$("table").delegate(".edit","click",function(){
				var airportCode = $(this).parent().parent().find("td[class=airportCode]").text()
				layer.open({
					type: 2,
					title: ['编辑机场','background-color:#6d6e72; color:#fff;font-size:14px;'],
					shadeClose: true,
					shade: [0.9,'#cfcfcf'],
					area: ['500px', '380px'],  
					content: ['../ak/editAirportMaintaince.html?airportCode='+airportCode],// iframe的url，no代表不显示滚动条
					end:function(){
						getAjax()
					}
						
				})	
			})
//________________________________________表头固定____________________________________________
			$("#dataTable").freezeHeader();
//________________________________________分页__________________________________
			$(".Pagination").load("Pagination.html",function(){
				getAjax();
			})		
		</script>
			
</html>
